<?php 

$entity = getInputArray("entity", $params, array());
$validate = getInputArray("validate", $params,str_replace(".","",str_replace(" ","",microtime())));
$categories = getInputArray("categories", $params, array());
?>
<form action="<?php echo WWWROOT;?>actions/admin/benefit/edit.php" method="POST" enctype="multipart/form-data">
	<div>
		<input type="hidden" name="id" value="<?php echo $entity->attributes->id ?>"></input>
	</div>	
	<div class="benefit_edit_column firstRow">
		
			<div class='left'>			
				<span class="imgText">
				<?php if (!$entity->hasIcon()) {
					echo langEcho("image");
				}else{
					echo "<img src='". $entity->getIcon() ."' title='". $entity->attributes->name ."' />";	
				}?></span>
				
			</div>
			<div class='right'>
				<div class='benefitDivInputContainer rounded'>
					<input type="file" name="icon"></input>
				</div>		
			</div>
		
	</div>
	<div class="benefit_edit_column">
		
			<div class='left'>
				<?php echo langEcho("title")?>
			</div>
			<div class='right'>
				<div class='benefitDivInputContainer rounded'>
					<?php echo loadView("input/text", array("name" => "name", "value" => $entity->attributes->getHTML("name"), "required" => true, "validate" => $validate, "class" => "txtBenefitName"));?>
				</div>		
			</div>
		
	</div>
	<div class="benefit_edit_column">
		
			<div class='left'>
				<?php echo langEcho("type")?>
			</div>
			<div class='right'>
				<div class='benefitDivInputContainer rounded'>				
					<?php echo loadView("input/select", array("name" => "idType", "value" => $entity->attributes->idType, "options" => Benefit::$types));?>
				</div>		
			</div>	
	</div>				
	<div class="benefit_edit_column">
		
			<div class='left'>
				<?php echo langEcho("description")?>
			</div>
			<div class='right'>
				<div class='benefitDivInputContainer rounded'>
					<?php echo loadView("input/textarea", array("name" => "description", "value" => $entity->attributes->getHTML("description",false), "required" => true, "validate" => $validate, "class" => "textAreaDesc"));?>
				</div>		
			</div>	
	</div>
	<div class="benefit_edit_column">
		
			<div class='left'>
				<?php echo langEcho("company")?>
			</div>
			<div class='right'>
				<div class='benefitDivInputContainer rounded'>
					<?php echo loadView("input/text", array("name" => "company", "value" => $entity->attributes->getHTML("company"), "required" => true, "validate" => $validate));?>
				</div>		
			</div>
		
	</div>
	<div class="benefit_edit_column" >		
		<div class='left'>
			<?php echo langEcho("category")?>
		</div>
		<div class='right'>
			<div class='benefitDivInputContainer rounded'>		
				<?php echo loadView("input/select", array("name" => "idCategory", "value" =>$entity->attributes->idCategory, "required" => true, "validate" => "", "options" => getArrayForSelect($categories, "name")));?>
			</div>		
		</div>
	</div>	
	<div class="benefit_edit_column" >		
		<div class='left'>
			<?php echo langEcho("startDateTime")?>
		</div>
		<div class='right'>
			<div class='benefitDivDateContainer rounded'>
				<?php echo loadView("input/date", array("name" => "startDateTime", "value" => $entity->attributes->startDateTime, "required" => true, "validate" => $validate, "title" => langEcho("start")));?>
			</div>			
		</div>
	</div>
	<div class="benefit_edit_column" >		
		<div class='left'>
			<?php echo langEcho("endDateTime")?>
		</div>
		<div class='right'>
			<div class='benefitDivDateContainer rounded'>
				<?php echo loadView("input/date", array("name" => "endDateTime", "value" => $entity->attributes->endDateTime, "required" => true, "validate" => $validate, "title" => langEcho("end")));?>
			</div>			
		</div>
	</div>	
	<div class="benefit_edit_column" style="display:none">
		<div class='left'>
			<?php echo langEcho("country")?>
		</div>
		<div class='right'>
			<div class='benefitDivInputContainer rounded'>
				<?php $entity->attributes->country = "Argentina"?>
				<?php echo loadView("input/select", array("name" => "country", "value" =>$entity->attributes->country, "required" => true, "validate" => $validate, "options" => getCountries(), "sort" => true, "firstOption" => array("" => "countries:")));?>
			</div>		
		</div>
	</div>
	<div class="benefit_edit_column">		
		<div class='left'>
			<?php echo langEcho("province")?>
		</div>
		<div class='right'>
			<div class='benefitDivInputContainer rounded'>
				<?php echo loadView("input/select", array("name" => "province", "value" =>$entity->attributes->province, "required" => true, "validate" => $validate, "options" => getProvinces(), "sort" => true, "firstOption" => array("" => "provinces:Seleccione")));?>
			</div>		
		</div>		
	</div>
	<div class="benefit_edit_column">		
		<div class='left'>
			<?php echo langEcho("city")?>
		</div>
		<div class='right'>
			<div class='benefitDivInputContainer rounded'>
				<?php echo loadView("input/text", array("name" => "city", "value" => $entity->attributes->getHTML("city"), "required" => true, "validate" => $validate));?>
			</div>		
		</div>		
	</div>
	<div class="benefit_edit_column">		
		<div class='left'>
			<?php echo langEcho("address")?>
		</div>
		<div class='right'>
			<div class='benefitDivInputContainer rounded'>
				<?php echo loadView("input/text", array("name" => "address", "value" => $entity->attributes->getHTML("address"), "required" => true, "validate" => $validate));?>
			</div>		
		</div>		
	</div>
	<div class="benefit_edit_column">		
		<div class='left'>
			<?php echo langEcho("number")?>
		</div>
		<div class='right'>
			<div class='benefitDivInputContainer rounded'>
				<?php echo loadView("input/text", array("name" => "number", "value" => $entity->attributes->getHTML("number"), "required" => true, "validate" => $validate));?>
			</div>		
		</div>		
	</div>	
	<div class="btnSubmitBenefitDivFloat">
		<?php echo loadView("input/submit", array("value" =>langEcho("save"), "validate" => $validate));?>
	</div>
	
</form>
<div class="clearFloat"></div>